From b4c854d5d2094f5a6266435095648a8b5a7a0e5e Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Fri, 17 Oct 2008 15:33:03 +0900 Subject: [PATCH] [IA64] make virt_to_maddr() to support both cached/uncached identity mapped area. The significant 8 bits of va are used by Xen, such as 0xf2 is used as uncache mapping. In function ioports_permit_access, mach_start = mmio_start | __pa(space->mmio_base); Mach_start gets wrong physical address. Signed-off-by: Anthony Xu --- xen/include/asm-ia64/linux-xen/asm/pgtable.h | 3 +++ xen/include/asm-ia64/xenpage.h | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/xen/include/asm-ia64/linux-xen/asm/pgtable.h b/xen/include/asm-ia64/linux-xen/asm/pgtable.h index 2bc246726e..adfd12a3bd 100644 --- a/xen/include/asm-ia64/linux-xen/asm/pgtable.h +++ b/xen/include/asm-ia64/linux-xen/asm/pgtable.h @@ -20,12 +20,15 @@ #include #include #ifdef XEN +#include #ifndef __ASSEMBLY__ #include /* needed for mm_struct (via asm/domain.h) */ #endif #endif +#ifndef XEN #define IA64_MAX_PHYS_BITS 50 /* max. number of physical address bits (architected) */ +#endif /* * First, define the various bits in a PTE. Note that the PTE format diff --git a/xen/include/asm-ia64/xenpage.h b/xen/include/asm-ia64/xenpage.h index be9e2142b6..7425bc22c5 100644 --- a/xen/include/asm-ia64/xenpage.h +++ b/xen/include/asm-ia64/xenpage.h @@ -1,6 +1,9 @@ #ifndef _ASM_IA64_XENPAGE_H #define _ASM_IA64_XENPAGE_H +/* moved from xen/include/asm-ia64/linux-xen/asm/pgtable.h to compile */ +#define IA64_MAX_PHYS_BITS 50 /* max. number of physical address bits (architected) */ + #ifndef __ASSEMBLY__ #undef mfn_valid #undef page_to_mfn @@ -23,7 +26,12 @@ static inline unsigned long __virt_to_maddr(unsigned long va) if (va - KERNEL_START < xenheap_size) return xen_pstart + (va - KERNEL_START); else - return (va & ((1UL << 60) - 1)); + /* + * Because the significant 8 bits of VA are used by Xen, + * and xen uses cached/uncached identity mapping. + * IA64_MAX_PHYS_BITS can't be larger than 56 + */ + return (va & ((1UL << IA64_MAX_PHYS_BITS) - 1)); } #define virt_to_maddr(va) (__virt_to_maddr((unsigned long)va)) -- 2.30.2